#include"Tree01.h"



BTNode* BuyNode(BTDataType x)
{
	BTNode* newnode = (BTNode*)malloc(sizeof(BTNode));
	newnode->data = x;
	newnode->left = NULL;
	newnode->right = NULL;
	return newnode;
}

BTNode* CreatTree()
{
	BTNode* n1 = BuyNode(1);
	BTNode* n2 = BuyNode(2);
	BTNode* n3 = BuyNode(3);
	BTNode* n4 = BuyNode(4);
	BTNode* n5 = BuyNode(5);
	BTNode* n6 = BuyNode(6);
	n1->left = n2;
	n2->left = n3;
	n2->right = n4;
	n1->right = n5;
	n5->right = n6;
	return n1;
}

void test()
{
	BTNode* root = CreatTree();
	PerOrder(root);
	cout << endl;
	InOrder(root);
	cout << endl;
	PostOrder(root);
	cout << endl;
	cout << BinaryTreeSize(root) << endl;
	cout << BinaryTreeLeafSize(root) << endl;
	cout << BinaryTreeLevelSize(root,3) << endl;
	cout << BinaryTreeDepth(root) << endl;
	LevelOrder(root);
	cout << endl;
	if (BinaryTreeComplete(root))
		cout << "yes" << endl;
	else
		cout << "no" << endl;

	BinaryTreeDestory(&root);
}

int main()
{
	test();
	return 0;
}